﻿using System;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PTA.Web
{
    /// <summary>
    /// WEB分页控件
    /// </summary>
    [
    DefaultProperty("Text"),
    ToolboxData("<{0}:AspnetPager runat=server></{0}:AspnetPager>"),
    DefaultEvent("PageIndexChanged")
    ]
    public class PageList : WebControl, IPostBackEventHandler
    {
        #region 控件定义和生成
        private SubmitTextBox txtPage;
        private Button btnExport;

        /// <summary>
        /// 控件列表
        /// </summary>
        public override ControlCollection Controls
        {
            get
            {
                EnsureChildControls();
                return base.Controls;
            }
        }

        /// <summary>
        /// 创建子控件
        /// </summary>
        protected override void CreateChildControls()
        {
            this.Controls.Clear();


            this.txtPage = new SubmitTextBox();

            this.txtPage.CssClass = "TxtGoTo";
            this.txtPage.ID = "txtPage";
            this.Controls.Add(this.txtPage);

            this.btnExport = new Button();
            this.btnExport.ID = "BtnExport";
            this.btnExport.Text = "导出";
            this.btnExport.CssClass = "BtnExport";
            this.btnExport.CommandName = "BtnExport";
            this.Controls.Add(this.btnExport);

            this.ChildControlsCreated = true;

        }

        #endregion

        #region 设置或获取每页要显示的数据项的数量

        /// <summary>
        /// 设置或获取每页要显示的数据项的数量
        /// </summary>
        [Bindable(true),
        Browsable(true),
        Description("设置每页要显示的数据项的数量"),
        Category("Data")]
        public int PageSize
        {
            get
            {
                return this.ViewState["PageSize"] != null ? (int)this.ViewState["PageSize"] : 10;
            }
            set
            {
                EnsureChildControls();
                this.ViewState["PageSize"] = value;
            }
        }
        #endregion 设置或获取每页要显示的数据项的数量

        #region 设置或获取总的数据项的数量
        /// <summary>
        /// 设置或获取总的数据项的数量
        /// </summary>
        [Bindable(true),
        Browsable(true),
        Description("设置总的数据项的数量"),
        Category("Data")]
        public int TotalCount
        {
            get
            {
                EnsureChildControls();
                return this.ViewState["TotalCount"] != null ? (int)this.ViewState["TotalCount"] : 0;
            }
            set
            {
                EnsureChildControls();
                this.ViewState["TotalCount"] = value;
            }
        }
        #endregion 设置或获取总的数据项的数量

        #region 设置或获取当前要显示的页码
        /// <summary>
        /// 设置或获取当前要显示的页码
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置当前要显示的页码,首页:0"),
        Category("Data")
        ]
        public int CurrentPageIndex
        {
            get
            {
                EnsureChildControls();
                return ViewState["currentPageIndex"] != null ? (int)ViewState["currentPageIndex"] : 0;
            }
            set
            {
                EnsureChildControls();
                ViewState["currentPageIndex"] = value;
            }
        }
        #endregion

        #region 设置或获取页码控件项的样式类

        /// <summary>
        /// 设置或获取页码控件项的样式类
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置页码控件项的样式类"),
        Category("Appearance")
        ]
        public string PageItemCssClass
        {
            get
            {
                return this.ViewState["PageItemCssClass"] != null ? (string)this.ViewState["PageItemCssClass"] : string.Empty;
            }
            set
            {
                EnsureChildControls();
                this.ViewState["PageItemCssClass"] = value;
            }
        }
        #endregion

        #region 设置或获取要显示的页码的数量

        /// <summary>
        /// 设置或获取要显示的页码的数量
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取要显示的页码的数量"),
        Category("Data")
        ]
        public int ShowPageCount
        {
            get
            {
                return this.ViewState["ShowPageCount"] != null ? (int)this.ViewState["ShowPageCount"] : 10;
            }
            set
            {
                this.ViewState["ShowPageCount"] = value >= 1 ? value : 10;
            }
        }
        #endregion 设置或获取要显示的页码的数量

        #region 设置或获取是否要显示的页码数字

        /// <summary>
        /// 设置或获取是否要显示的页码数字
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示的页码数字"),
        Category("Data")
        ]
        public bool ShowPageNumeric
        {
            get
            {
                return this.ViewState["ShowPageNumeric"] != null ? (bool)this.ViewState["ShowPageNumeric"] : true;
            }
            set
            {
                this.ViewState["ShowPageNumeric"] = value;
            }
        }
        #endregion 设置或获取是否要显示的页码数字

        #region 设置或获取是否要显示跳转到按钮和文本框

        /// <summary>
        /// 设置或获取是否要显示跳转到按钮和文本框
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示跳转到按钮和文本框"),
        Category("Data")
        ]
        public bool ShowGoToButton
        {
            get
            {
                return this.ViewState["ShowGoToButton"] != null ? (bool)this.ViewState["ShowGoToButton"] : true;
            }
            set
            {
                this.ViewState["ShowGoToButton"] = value;
            }
        }
        #endregion 设置或获取是否要显示跳转到按钮和文本框

        #region 设置或获取是否要显示查询结果信息

        /// <summary>
        /// 设置或获取是否要显示查询结果信息
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示查询结果信息"),
        Category("Data")
        ]
        public bool ShowResultSummary
        {
            get
            {
                return this.ViewState["ShowResultSummary"] != null ? (bool)this.ViewState["ShowResultSummary"] : true;
            }
            set
            {
                this.ViewState["ShowResultSummary"] = value;
            }
        }
        #endregion 设置或获取是否要显示查询结果信息

        #region 设置上一页下一页的信息

        #region 设置或获取是否要显示上一页下一页
        /// <summary>
        /// 设置或获取是否要显示上一页下一页
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示上一页下一页"),
        Category("Appearance")
        ]
        public bool ShowPrevNext
        {
            get
            {
                return this.ViewState["ShowPrevNext"] != null ? (bool)this.ViewState["ShowPrevNext"] : true;
            }
            set
            {
                this.ViewState["ShowPrevNext"] = value;
            }
        }
        #endregion 设置或获取是否要显示上一页下一页

        #region 要显示"首页"的名称
        /// <summary>
        /// 设置或获取是否要显示"上一页"的名称
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("要显示\"首页\"的名称"),
        Category("Appearance")
        ]
        public string FirstPageTitle
        {
            get
            {
                return this.ViewState["FirstPageTitle"] != null ? (string)this.ViewState["FirstPageTitle"] : "首页";
            }
            set
            {
                this.ViewState["FirstPageTitle"] = value;
            }
        }
        #endregion 设置或获取是否要显示"首页"的名称

        #region 要显示"上一页"的名称
        /// <summary>
        /// 设置或获取是否要显示"上一页"的名称
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("要显示\"上一页\"的名称"),
        Category("Appearance")
        ]
        public string PrevPageTitle
        {
            get
            {
                return this.ViewState["PrevPageTitle"] != null ? (string)this.ViewState["PrevPageTitle"] : "上一页";
            }
            set
            {
                this.ViewState["PrevPageTitle"] = value;
            }
        }
        #endregion 设置或获取是否要显示"上一页"的名称

        #region 要显示"下一页"的名称

        /// <summary>
        /// 要显示"下一页"的名称
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("要显示\"下一页\"的名称"),
        Category("Appearance")
        ]
        public string NextPageTitle
        {
            get
            {
                return this.ViewState["NextPageTitle"] != null ? (string)this.ViewState["NextPageTitle"] : "下一页";
            }
            set
            {
                this.ViewState["NextPageTitle"] = value;
            }
        }
        #endregion 设置或获取是否要显示"上一页"的名称

        #region 要显示"尾页"的名称
        /// <summary>
        /// 设置或获取是否要显示"上一页"的名称
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("要显示\"尾页\"的名称"),
        Category("Appearance")
        ]
        public string LastPageTitle
        {
            get
            {
                return this.ViewState["LastPageTitle"] != null ? (string)this.ViewState["LastPageTitle"] : "尾页";
            }
            set
            {
                this.ViewState["LastPageTitle"] = value;
            }
        }
        #endregion 设置或获取是否要显示"尾页"的名称

        #region 设置或获取是否要显示上一页下一页的图片
        /// <summary>
        /// 设置或获取是否要显示上一页下一页的图片
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示上一页下一页"),
        Category("Appearance")
        ]
        public bool ShowPrevNextImage
        {
            get
            {
                return this.ViewState["ShowPrevNextPicture"] != null ? (bool)this.ViewState["ShowPrevNextPicture"] : true;
            }
            set
            {
                this.ViewState["ShowPrevNextPicture"] = value;
            }
        }
        #endregion 设置或获取是否要显示上一页下一页

        #region 设置或获取是否要显示"上一页"的图片路径名称
        /// <summary>
        /// 设置或获取是否要显示"上一页"的图片路径名称
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示\"上一页\"的图片路径名称"),
        Category("Appearance")
        ]
        public string PrevPageImagePath
        {
            get
            {
                return this.ViewState["PrevPageImagePath"] != null ? (string)this.ViewState["PrevPageImagePath"] : string.Empty;
            }
            set
            {
                this.ViewState["PrevPageImagePath"] = value;
            }
        }
        #endregion 设置或获取是否要显示"上一页"的图片路径名称

        #region 设置或获取是否要显示"下一页"的图片路径名称
        /// <summary>
        /// 设置或获取是否要显示"下一页"的图片路径名称
        /// </summary>
        [
        Bindable(true),
        Browsable(true),
        Description("设置或获取是否要显示\"下一页\"的图片路径名称"),
        Category("Appearance")
        ]
        public string NextPageImagePath
        {
            get
            {
                return this.ViewState["NextPageImagePath"] != null ? (string)this.ViewState["NextPageImagePath"] : string.Empty;
            }
            set
            {
                this.ViewState["NextPageImagePath"] = value;
            }
        }
        #endregion 设置或获取是否要显示"下一页"的图片路径名称

        #endregion 设置上一页下一页的信息

        #region 是否显示导出控件
        /// <summary>
        /// 是否显示导出控件
        /// </summary>
        public bool ShowExport
        {
            get
            {
                return ViewState["ShowExport"] == null ? false : (bool)ViewState["ShowExport"];
            }
            set
            {
                ViewState["ShowExport"] = value;
            }
        }

        #endregion

        #region 呈现控件

        /// <summary>
        /// 呈现控件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            this.txtPage.TargetContorlClientID = this.ClientID + this.IdSeparator + "btnGo";
            base.OnPreRender(e);
        }
        /// <summary>
        /// 为控件添加属性
        /// </summary>
        /// <param name="writer"></param>
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageList");
            base.AddAttributesToRender(writer);
        }


        /// <summary>
        /// 重写TagKey属性,
        /// </summary>
        protected override HtmlTextWriterTag TagKey
        {
            get
            {
                return HtmlTextWriterTag.Table;
            }
        }

        /// <summary>
        /// 呈现控件
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            int pageCount = 0;
            if (TotalCount > 0)
            {
                pageCount = (TotalCount + PageSize - 1) / PageSize;
            }
            if (this.CurrentPageIndex < 0)
            {
                this.CurrentPageIndex = 0;
            }
            if (this.CurrentPageIndex >= pageCount)
            {
                this.CurrentPageIndex = pageCount - 1;
            }

            PostBackOptions options = new PostBackOptions(this);
            options.RequiresJavaScriptProtocol = true;

            int pageFrom = CurrentPageIndex / ShowPageCount * ShowPageCount;//设置从多少页开始输出
            int pageTo = pageFrom + ShowPageCount;//设置到多少页结束

            pageTo = pageTo < pageCount ? pageTo : pageCount;//修正要显示的尾页数

            int prevPage = CurrentPageIndex - 1;
            int nextPage = CurrentPageIndex + 1;

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            #region 输出第一个单元格
            if (this.ShowResultSummary)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListDescCell");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write(string.Format("共{0}条记录，当前第：{1}页/共：{2}页", this.TotalCount, this.CurrentPageIndex + 1, pageCount));
                writer.RenderEndTag();
            }
            #endregion

            #region 输出页码信息
            if (this.CurrentPageIndex > 0)
            {
                #region 输出首页
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListFirstPage");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                options = new PostBackOptions(this, "0");
                options.RequiresJavaScriptProtocol = true;
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(options));
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(this.FirstPageTitle);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                #endregion 输出首页

                #region 输出上一页
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListPrevPage");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                options.Argument = prevPage.ToString(); //得到currentPageIndex的前..页.
                writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference(options));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(this.PrevPageTitle);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                #endregion
            }

            #region 输出页码
            if (this.ShowPageNumeric)
            {
                #region 输入当前页之前的页码
                for (int i = pageFrom; i < this.CurrentPageIndex; i++)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListPage");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    options.Argument = i.ToString();
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference(options));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write((i + 1).ToString());
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
                #endregion 输入当前页之前的页码

                #region 输出当前页码
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListCurrentPage disabled");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write((this.CurrentPageIndex + 1).ToString());
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                #endregion 输出当前页码

                #region 输出当前页之后的页码
                for (int i = this.CurrentPageIndex + 1; i < pageTo; i++)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListPage");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    options.Argument = i.ToString();
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference(options));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write((i + 1).ToString());
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
                #endregion 输出当前页之后的页码
            }
            #endregion

            if (this.CurrentPageIndex + 1 < pageCount)
            {
                #region 输出下一页
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListNextPage");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                options.Argument = nextPage.ToString();
                writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference(options));
                writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference(options));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(this.NextPageTitle);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                #endregion

                #region 输出最后一页
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlWebPageListNumberCell LvlWebPageListLastPage");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                options.Argument = (pageCount - 1).ToString();
                writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference(options));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(this.LastPageTitle);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();
                #endregion 输出最后一页
            }
            #endregion

            #region 输出第三个单元格
            if (this.ShowGoToButton)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlPageGoToCell");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write("转到第");
                this.txtPage.Text = (this.CurrentPageIndex + 1).ToString();
                this.txtPage.RenderControl(writer);
                writer.Write("页");

                options = new PostBackOptions(this, "GO");
                options.RequiresJavaScriptProtocol = false;
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(options));
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + this.ClientIDSeparator + "btnGo");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "BtnGoTo");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("GO");
                writer.RenderEndTag();
                writer.RenderEndTag();
            }
            #endregion

            #region 导出控件
            if (ShowExport)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "LvlPageExportCell");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                options = new PostBackOptions(this, "EXPORT");
                options.RequiresJavaScriptProtocol = false;
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(options));
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + this.ClientIDSeparator + "btnExport");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "btnExport");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("导出");
                writer.RenderEndTag();
                writer.RenderEndTag();  
            }
            #endregion

            writer.RenderEndTag(); // end of table
        }

        #endregion

        #region IPostBackEventHandler 成员

        void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
        {
            if (eventArgument.Equals("EXPORT", StringComparison.OrdinalIgnoreCase))
            {
                OnBtnExportClick(EventArgs.Empty);
                return;
            }
            int newPageIndex = this.CurrentPageIndex + 1;
            if (eventArgument.Equals("GO", StringComparison.OrdinalIgnoreCase))
            {
                if (PTA.Convert.IsInt(this.txtPage.Text) && PTA.Convert.ToInt32(this.txtPage.Text) > 0)
                {
                    newPageIndex = PTA.Convert.ToInt32(this.txtPage.Text) - 1;
                }
            }
            else
            {
                if (PTA.Convert.IsInt(eventArgument) && PTA.Convert.ToInt32(eventArgument) >= 0)
                {
                    newPageIndex = PTA.Convert.ToInt32(eventArgument);
                }
            }
            PageChangedEventArgs e = new PageChangedEventArgs(newPageIndex);
            OnPageIndexChanged(e);
        }

        #endregion

        #region 页码变换事件
        private static readonly object EventPageIndexChanged = new object();
        /// <summary>
        /// 页码变换事件
        /// </summary>
        [Bindable(true),
        Browsable(true),
        Category("Event")]
        public event PageIndexChangingEventHandler PageIndexChanged
        {
            add
            {
                this.Events.AddHandler(EventPageIndexChanged, value);
            }
            remove
            {
                this.Events.RemoveHandler(EventPageIndexChanged, value);
            }
        }
        private void OnPageIndexChanged(PageChangedEventArgs e)
        {
            PageIndexChangingEventHandler handler = (PageIndexChangingEventHandler)Events[EventPageIndexChanged];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        #endregion

        #region 导出按钮事件
        private static readonly object EventBtnExportClick = new object();
        /// <summary>
        /// 导出按钮点击事件
        /// </summary>
        public event EventHandler BtnExportClick
        {
            add
            {
                this.Events.AddHandler(EventBtnExportClick, value);
            }
            remove
            {
                this.Events.RemoveHandler(EventBtnExportClick, value);
            }
        }

        private void OnBtnExportClick(EventArgs e)
        {
            EventHandler handler = (EventHandler)this.Events[EventBtnExportClick];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        #endregion

    }

    /// <summary>
    /// PageChange事件的参数
    /// </summary>
    public class PageChangedEventArgs : EventArgs
    {
        private int newPageIndex;
        /// <summary>
        /// 新页码
        /// </summary>
        public int NewPageIndex
        {
            get
            {
                return this.newPageIndex;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="newPageIndex">新页码</param>
        public PageChangedEventArgs(int newPageIndex)
        {
            this.newPageIndex = newPageIndex;
        }
    }

    /// <summary>
    /// 页码变换事件
    /// </summary>
    /// <param name="src">触发事件的控件源</param>
    /// <param name="e">事件参数</param>
    public delegate void PageIndexChangingEventHandler(object src, PageChangedEventArgs e);

}
